<?php
namespace app\index\controller;
/**
 * Created by Submint Text.
 * User: hetaoren<452649510@qq.com>
 * Date: 2017/03/10
 * Explain: 职员控制器
 */
class Staffs extends Base{
    public function index(){
        $this->assign("roles",model('Roles')->listQuery());
    	return $this->fetch("list");
    }
    /**
     * 获取分页
     */
    public function pageQuery(){
    	return model('Staffs')->pageQuery();
    }
    /**
     * 获取
     */
    public function get(){
    	return model('Staffs')->get((int)Input("post.id"));
    }
    /**
     * 跳去新增界面
     */
    public function toAdd(){
    	$this->assign("object",['staffId'=>0,'staffStatus'=>1]);
    	$this->assign("roles",model('Roles')->listQuery());
    	return $this->fetch("add");
    }
    /**
     * 跳去编辑页面
     */
    public function toEdit(){
    	$id = (int)Input("get.id",0);
    	$rs = model('Staffs')->getById($id);
    	$this->assign("object",$rs);
    	$this->assign("roles",model('Roles')->listQuery());
    	return $this->fetch("edit");
    }
    /**
     * 新增
     */
    public function add(){
    	return model('Staffs')->add();
    }
    /**
     * 编辑菜单
     */
    public function edit(){
    	return model('Staffs')->edit();
    }
    /**
     * 删除菜单
     */
    public function del(){
    	return model('Staffs')->del();
    }
    /**
     * 检测账号是否重复
     */
    public function checkLoginKey(){
    	return model('Staffs')->checkLoginKey(input('post.key'));
    }
    /**
     * 编辑自己密码
     */
    public function editMyPass(){
    	return model('Staffs')->editMyPass((int)session('HTR_STAFF.staffId'));
    }
    /**
     * 编辑职员密码
     */
    public function editPass(){
    	return model('Staffs')->editPass((int)input('post.staffId'));
    }
}
